#Module makefile

##Module name
MODULE=wifihack

obj-m += $(MODULE).o 

$(MODULE)-objs := $(MODULE)_mod.o drv.o
#Note that if you want to generate a module called "whatever.ko" and you want to use the
#kbuild system, you need the source files to be called in a different way, (even the module source file)
#such as we did in our case postpending the "_mod" to the filename. That is, files defined for "obj-m"
#variable must be named differently from files defined for "$(MODULE-objs


all:
	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

load:
	./loadScript.sh
	
unload:
	@echo "Removing module..." & \
	if [ -e /sys/module/$(MODULE) ]; then rmmod $(MODULE); fi; \
	if [ -e /dev/$(MODULE) ]; then rm /dev/$(MODULE); fi;
